package com.cike.sparkstudy.core.scala

import org.apache.spark.{SparkConf, SparkContext}

object LineCount {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("LineCount").setMaster("local");

    val sc = new SparkContext(conf);

    val lines = sc.textFile("D://DevelopeCodes//DemoData//sparktest.txt");

    val pairs = lines.map(line=>(lines,1))

    val lineCounts = pairs.reduceByKey(_+_);

    lineCounts.foreach(lineCount=>println(lineCount._1+"出现了："+lineCount._2))
  }
}
